{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import re\n",
    "import os \n",
    "import pandas as pd\n",
    "import numpy as np"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "path = 'C:\\\\jupyter-notebook-files\\\\py3\\\\供电量数据'\n",
    "files = os.listdir(path)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "scrolled": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "['dataPreprocessing_drop_duplicates.csv', 'weather.csv', '月报表_月电量导出报表分析1401.xls', '月报表_月电量导出报表分析1402.xls', '月报表_月电量导出报表分析1403.xls', '月报表_月电量导出报表分析1404.xls', '月报表_月电量导出报表分析1405.xls', '月报表_月电量导出报表分析1406.xls', '月报表_月电量导出报表分析1407.xls', '月报表_月电量导出报表分析1408.xls', '月报表_月电量导出报表分析1409.xls', '月报表_月电量导出报表分析1410.xls', '月报表_月电量导出报表分析1411.xls', '月报表_月电量导出报表分析1412.xls', '月报表_月电量导出报表分析1501.xls', '月报表_月电量导出报表分析1502.xls', '月报表_月电量导出报表分析1503.xls', '月报表_月电量导出报表分析1504.xls', '月报表_月电量导出报表分析1505.xls', '月报表_月电量导出报表分析1506.xls', '月报表_月电量导出报表分析1507.xls', '月报表_月电量导出报表分析1508.xls', '月报表_月电量导出报表分析1509.xls', '月报表_月电量导出报表分析1510.xls', '月报表_月电量导出报表分析1511.xls', '月报表_月电量导出报表分析1512.xls', '月报表_月电量导出报表分析1601.xls', '月报表_月电量导出报表分析1602.xls', '月报表_月电量导出报表分析1603.xls', '月报表_月电量导出报表分析1604.xls', '月报表_月电量导出报表分析1605.xls', '月报表_月电量导出报表分析1606.xls', '月报表_月电量导出报表分析1607.xls', '月报表_月电量导出报表分析1608.xls', '月报表_月电量导出报表分析1609.xls', '月报表_月电量导出报表分析1610.xls', '月报表_月电量导出报表分析1611.xls', '月报表_月电量导出报表分析1612.xls', '月报表_月电量导出报表分析1701.xls', '月报表_月电量导出报表分析1702.xls', '月报表_月电量导出报表分析1703.xls', '月报表_月电量导出报表分析1704.xls', '月报表_月电量导出报表分析1705.xls', '月报表_月电量导出报表分析1706.xls', '月报表_月电量导出报表分析1707.xls', '月报表_月电量导出报表分析1708.xls', '月报表_月电量导出报表分析1709.xls', '月报表_月电量导出报表分析1710.xls']\n"
     ]
    }
   ],
   "source": [
    "print (files)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "os.chdir(path)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'C:\\\\jupyter-notebook-files\\\\py3\\\\供电量数据'"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "os.getcwd()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "data_csv = pd.read_csv('dataPreprocessing_drop_duplicates.csv')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Date</th>\n",
       "      <th>DailyElectricity</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2014/01/01</td>\n",
       "      <td>92750.080000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2014/01/02</td>\n",
       "      <td>129481.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2014/01/03</td>\n",
       "      <td>161360.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>2014/01/04</td>\n",
       "      <td>148608.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>2014/01/05</td>\n",
       "      <td>138985.570786</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>2014/01/06</td>\n",
       "      <td>156729.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>2014/01/07</td>\n",
       "      <td>165086.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>2014/01/08</td>\n",
       "      <td>165642.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>2014/01/09</td>\n",
       "      <td>164249.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>2014/01/10</td>\n",
       "      <td>160739.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>2014/01/11</td>\n",
       "      <td>160739.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>2014/01/12</td>\n",
       "      <td>141705.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>2014/01/13</td>\n",
       "      <td>151591.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>2014/01/14</td>\n",
       "      <td>160998.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>2014/01/15</td>\n",
       "      <td>159013.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>2014/01/16</td>\n",
       "      <td>156966.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>2014/01/17</td>\n",
       "      <td>154241.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>2014/01/18</td>\n",
       "      <td>146531.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>2014/01/19</td>\n",
       "      <td>129968.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>2014/01/20</td>\n",
       "      <td>131560.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>2014/01/21</td>\n",
       "      <td>131031.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>2014/01/22</td>\n",
       "      <td>124284.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22</th>\n",
       "      <td>2014/01/23</td>\n",
       "      <td>115689.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>2014/01/24</td>\n",
       "      <td>103834.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24</th>\n",
       "      <td>2014/01/25</td>\n",
       "      <td>89054.080000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25</th>\n",
       "      <td>2014/01/26</td>\n",
       "      <td>76452.400000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26</th>\n",
       "      <td>2014/01/27</td>\n",
       "      <td>67931.356070</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27</th>\n",
       "      <td>2014/01/28</td>\n",
       "      <td>62932.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>28</th>\n",
       "      <td>2014/01/29</td>\n",
       "      <td>54918.400000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>29</th>\n",
       "      <td>2014/01/30</td>\n",
       "      <td>46260.480000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1370</th>\n",
       "      <td>2017/10/02</td>\n",
       "      <td>128278.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1371</th>\n",
       "      <td>2017/10/03</td>\n",
       "      <td>134228.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1372</th>\n",
       "      <td>2017/10/04</td>\n",
       "      <td>124562.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1373</th>\n",
       "      <td>2017/10/05</td>\n",
       "      <td>176747.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1374</th>\n",
       "      <td>2017/10/06</td>\n",
       "      <td>222162.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1375</th>\n",
       "      <td>2017/10/07</td>\n",
       "      <td>239224.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1376</th>\n",
       "      <td>2017/10/08</td>\n",
       "      <td>234974.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1377</th>\n",
       "      <td>2017/10/09</td>\n",
       "      <td>258824.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1378</th>\n",
       "      <td>2017/10/10</td>\n",
       "      <td>270325.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1379</th>\n",
       "      <td>2017/10/11</td>\n",
       "      <td>276078.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1380</th>\n",
       "      <td>2017/10/12</td>\n",
       "      <td>269369.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1381</th>\n",
       "      <td>2017/10/13</td>\n",
       "      <td>240332.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1382</th>\n",
       "      <td>2017/10/14</td>\n",
       "      <td>215387.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1383</th>\n",
       "      <td>2017/10/15</td>\n",
       "      <td>172456.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1384</th>\n",
       "      <td>2017/10/16</td>\n",
       "      <td>200448.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1385</th>\n",
       "      <td>2017/10/17</td>\n",
       "      <td>213012.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1386</th>\n",
       "      <td>2017/10/18</td>\n",
       "      <td>218822.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1387</th>\n",
       "      <td>2017/10/19</td>\n",
       "      <td>216934.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1388</th>\n",
       "      <td>2017/10/20</td>\n",
       "      <td>214429.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1389</th>\n",
       "      <td>2017/10/21</td>\n",
       "      <td>204973.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1390</th>\n",
       "      <td>2017/10/22</td>\n",
       "      <td>171328.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1391</th>\n",
       "      <td>2017/10/23</td>\n",
       "      <td>200922.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1392</th>\n",
       "      <td>2017/10/24</td>\n",
       "      <td>212075.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1393</th>\n",
       "      <td>2017/10/25</td>\n",
       "      <td>214232.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1394</th>\n",
       "      <td>2017/10/26</td>\n",
       "      <td>215863.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1395</th>\n",
       "      <td>2017/10/27</td>\n",
       "      <td>215716.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1396</th>\n",
       "      <td>2017/10/28</td>\n",
       "      <td>207028.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1397</th>\n",
       "      <td>2017/10/29</td>\n",
       "      <td>171648.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1398</th>\n",
       "      <td>2017/10/30</td>\n",
       "      <td>197594.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1399</th>\n",
       "      <td>2017/10/31</td>\n",
       "      <td>198831.000000</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>1400 rows × 2 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "            Date  DailyElectricity\n",
       "0     2014/01/01      92750.080000\n",
       "1     2014/01/02     129481.000000\n",
       "2     2014/01/03     161360.000000\n",
       "3     2014/01/04     148608.000000\n",
       "4     2014/01/05     138985.570786\n",
       "5     2014/01/06     156729.000000\n",
       "6     2014/01/07     165086.000000\n",
       "7     2014/01/08     165642.000000\n",
       "8     2014/01/09     164249.000000\n",
       "9     2014/01/10     160739.000000\n",
       "10    2014/01/11     160739.000000\n",
       "11    2014/01/12     141705.000000\n",
       "12    2014/01/13     151591.000000\n",
       "13    2014/01/14     160998.000000\n",
       "14    2014/01/15     159013.000000\n",
       "15    2014/01/16     156966.000000\n",
       "16    2014/01/17     154241.000000\n",
       "17    2014/01/18     146531.000000\n",
       "18    2014/01/19     129968.000000\n",
       "19    2014/01/20     131560.000000\n",
       "20    2014/01/21     131031.000000\n",
       "21    2014/01/22     124284.000000\n",
       "22    2014/01/23     115689.000000\n",
       "23    2014/01/24     103834.000000\n",
       "24    2014/01/25      89054.080000\n",
       "25    2014/01/26      76452.400000\n",
       "26    2014/01/27      67931.356070\n",
       "27    2014/01/28      62932.000000\n",
       "28    2014/01/29      54918.400000\n",
       "29    2014/01/30      46260.480000\n",
       "...          ...               ...\n",
       "1370  2017/10/02     128278.000000\n",
       "1371  2017/10/03     134228.000000\n",
       "1372  2017/10/04     124562.000000\n",
       "1373  2017/10/05     176747.000000\n",
       "1374  2017/10/06     222162.000000\n",
       "1375  2017/10/07     239224.000000\n",
       "1376  2017/10/08     234974.000000\n",
       "1377  2017/10/09     258824.000000\n",
       "1378  2017/10/10     270325.000000\n",
       "1379  2017/10/11     276078.000000\n",
       "1380  2017/10/12     269369.000000\n",
       "1381  2017/10/13     240332.000000\n",
       "1382  2017/10/14     215387.000000\n",
       "1383  2017/10/15     172456.000000\n",
       "1384  2017/10/16     200448.000000\n",
       "1385  2017/10/17     213012.000000\n",
       "1386  2017/10/18     218822.000000\n",
       "1387  2017/10/19     216934.000000\n",
       "1388  2017/10/20     214429.000000\n",
       "1389  2017/10/21     204973.000000\n",
       "1390  2017/10/22     171328.000000\n",
       "1391  2017/10/23     200922.000000\n",
       "1392  2017/10/24     212075.000000\n",
       "1393  2017/10/25     214232.000000\n",
       "1394  2017/10/26     215863.000000\n",
       "1395  2017/10/27     215716.000000\n",
       "1396  2017/10/28     207028.000000\n",
       "1397  2017/10/29     171648.000000\n",
       "1398  2017/10/30     197594.000000\n",
       "1399  2017/10/31     198831.000000\n",
       "\n",
       "[1400 rows x 2 columns]"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data_csv"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "scrolled": true
   },
   "outputs": [],
   "source": [
    "data_clip = data_csv['Date'].str.split('/',expand=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [],
   "source": [
    "df_year = data_clip[0]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [],
   "source": [
    "df_month = data_clip[1]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [],
   "source": [
    "df_day = data_clip[2]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [],
   "source": [
    "data_csv['year'] = df_year\n",
    "data_csv['month'] = df_month\n",
    "data_csv['day'] = df_day"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [],
   "source": [
    "import matplotlib.pyplot as plt\n",
    "from sklearn.model_selection import cross_val_score\n",
    "from sklearn.model_selection import train_test_split"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 76,
   "metadata": {},
   "outputs": [],
   "source": [
    "# x_train,x_test,y_train,y_test = train_test_split(X,Y,test_size=0.3,random_state=0)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "metadata": {
    "scrolled": false
   },
   "outputs": [],
   "source": [
    "# %matplotlib inline"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 77,
   "metadata": {},
   "outputs": [],
   "source": [
    "# #随机森林\n",
    "# #交叉验证\n",
    "# from sklearn.ensemble import RandomForestRegressor\n",
    "# max_features = [.1,.6,.7,.8,.9,1]\n",
    "# test_loss = []\n",
    "# test_accuarcy = []\n",
    "# for max_feat in max_features:\n",
    "#     clf = RandomForestRegressor(n_estimators=100,max_features=max_feat)\n",
    "#     loss = -cross_val_score(clf,X,Y,cv=5,scoring='neg_mean_squared_error')#loss 损失函数\n",
    "#     test_loss.append(loss.mean())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 78,
   "metadata": {},
   "outputs": [],
   "source": [
    "# plt.subplot(1,2,1)\n",
    "# plt.plot(max_features,test_loss)\n",
    "# plt.title(\"RF\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 79,
   "metadata": {},
   "outputs": [],
   "source": [
    "# clf_rf = RandomForestRegressor(n_estimators=100,max_features=.8)\n",
    "# clf_rf.fit(x_train,y_train)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 80,
   "metadata": {},
   "outputs": [],
   "source": [
    "# result = clf_rf.predict(x_test)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 81,
   "metadata": {},
   "outputs": [],
   "source": [
    "# clf_rf.score(x_test,y_test)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 82,
   "metadata": {
    "scrolled": true
   },
   "outputs": [],
   "source": [
    "# #1400 rows x 5 columns\n",
    "# data_csv.describe"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {
    "scrolled": true
   },
   "outputs": [],
   "source": [
    "weather_csv = pd.read_csv('weather.csv',encoding = 'gb18030')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [],
   "source": [
    "data_csv['weather'] = weather_csv['temperature'][:1400]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [],
   "source": [
    "weather_clip = data_csv['weather'].str.split('/',expand=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [],
   "source": [
    "weather_high = weather_clip[0].apply(lambda x:x.split('℃')[0])  \n",
    "weather_low = weather_clip[1].apply(lambda x:x.split('℃')[0])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [],
   "source": [
    "data_csv['Maximum temperature'] = weather_high\n",
    "data_csv['Lowest temperature'] = weather_low"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Date</th>\n",
       "      <th>DailyElectricity</th>\n",
       "      <th>year</th>\n",
       "      <th>month</th>\n",
       "      <th>day</th>\n",
       "      <th>weather</th>\n",
       "      <th>Maximum temperature</th>\n",
       "      <th>Lowest temperature</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2014/01/01</td>\n",
       "      <td>92750.080000</td>\n",
       "      <td>2014</td>\n",
       "      <td>01</td>\n",
       "      <td>01</td>\n",
       "      <td>20℃ / 12℃</td>\n",
       "      <td>20</td>\n",
       "      <td>12</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2014/01/02</td>\n",
       "      <td>129481.000000</td>\n",
       "      <td>2014</td>\n",
       "      <td>01</td>\n",
       "      <td>02</td>\n",
       "      <td>22℃ / 14℃</td>\n",
       "      <td>22</td>\n",
       "      <td>14</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2014/01/03</td>\n",
       "      <td>161360.000000</td>\n",
       "      <td>2014</td>\n",
       "      <td>01</td>\n",
       "      <td>03</td>\n",
       "      <td>22℃ / 14℃</td>\n",
       "      <td>22</td>\n",
       "      <td>14</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>2014/01/04</td>\n",
       "      <td>148608.000000</td>\n",
       "      <td>2014</td>\n",
       "      <td>01</td>\n",
       "      <td>04</td>\n",
       "      <td>21℃ / 12℃</td>\n",
       "      <td>21</td>\n",
       "      <td>12</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>2014/01/05</td>\n",
       "      <td>138985.570786</td>\n",
       "      <td>2014</td>\n",
       "      <td>01</td>\n",
       "      <td>05</td>\n",
       "      <td>20℃ / 13℃</td>\n",
       "      <td>20</td>\n",
       "      <td>13</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>2014/01/06</td>\n",
       "      <td>156729.000000</td>\n",
       "      <td>2014</td>\n",
       "      <td>01</td>\n",
       "      <td>06</td>\n",
       "      <td>22℃ / 14℃</td>\n",
       "      <td>22</td>\n",
       "      <td>14</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>2014/01/07</td>\n",
       "      <td>165086.000000</td>\n",
       "      <td>2014</td>\n",
       "      <td>01</td>\n",
       "      <td>07</td>\n",
       "      <td>22℃ / 15℃</td>\n",
       "      <td>22</td>\n",
       "      <td>15</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>2014/01/08</td>\n",
       "      <td>165642.000000</td>\n",
       "      <td>2014</td>\n",
       "      <td>01</td>\n",
       "      <td>08</td>\n",
       "      <td>20℃ / 11℃</td>\n",
       "      <td>20</td>\n",
       "      <td>11</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>2014/01/09</td>\n",
       "      <td>164249.000000</td>\n",
       "      <td>2014</td>\n",
       "      <td>01</td>\n",
       "      <td>09</td>\n",
       "      <td>18℃ / 11℃</td>\n",
       "      <td>18</td>\n",
       "      <td>11</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>2014/01/10</td>\n",
       "      <td>160739.000000</td>\n",
       "      <td>2014</td>\n",
       "      <td>01</td>\n",
       "      <td>10</td>\n",
       "      <td>17℃ / 13℃</td>\n",
       "      <td>17</td>\n",
       "      <td>13</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>2014/01/11</td>\n",
       "      <td>160739.000000</td>\n",
       "      <td>2014</td>\n",
       "      <td>01</td>\n",
       "      <td>11</td>\n",
       "      <td>20℃ / 13℃</td>\n",
       "      <td>20</td>\n",
       "      <td>13</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>2014/01/12</td>\n",
       "      <td>141705.000000</td>\n",
       "      <td>2014</td>\n",
       "      <td>01</td>\n",
       "      <td>12</td>\n",
       "      <td>20℃ / 9℃</td>\n",
       "      <td>20</td>\n",
       "      <td>9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>2014/01/13</td>\n",
       "      <td>151591.000000</td>\n",
       "      <td>2014</td>\n",
       "      <td>01</td>\n",
       "      <td>13</td>\n",
       "      <td>16℃ / 8℃</td>\n",
       "      <td>16</td>\n",
       "      <td>8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>2014/01/14</td>\n",
       "      <td>160998.000000</td>\n",
       "      <td>2014</td>\n",
       "      <td>01</td>\n",
       "      <td>14</td>\n",
       "      <td>16℃ / 7℃</td>\n",
       "      <td>16</td>\n",
       "      <td>7</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>2014/01/15</td>\n",
       "      <td>159013.000000</td>\n",
       "      <td>2014</td>\n",
       "      <td>01</td>\n",
       "      <td>15</td>\n",
       "      <td>17℃ / 8℃</td>\n",
       "      <td>17</td>\n",
       "      <td>8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>2014/01/16</td>\n",
       "      <td>156966.000000</td>\n",
       "      <td>2014</td>\n",
       "      <td>01</td>\n",
       "      <td>16</td>\n",
       "      <td>18℃ / 10℃</td>\n",
       "      <td>18</td>\n",
       "      <td>10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>2014/01/17</td>\n",
       "      <td>154241.000000</td>\n",
       "      <td>2014</td>\n",
       "      <td>01</td>\n",
       "      <td>17</td>\n",
       "      <td>20℃ / 10℃</td>\n",
       "      <td>20</td>\n",
       "      <td>10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>2014/01/18</td>\n",
       "      <td>146531.000000</td>\n",
       "      <td>2014</td>\n",
       "      <td>01</td>\n",
       "      <td>18</td>\n",
       "      <td>20℃ / 9℃</td>\n",
       "      <td>20</td>\n",
       "      <td>9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>2014/01/19</td>\n",
       "      <td>129968.000000</td>\n",
       "      <td>2014</td>\n",
       "      <td>01</td>\n",
       "      <td>19</td>\n",
       "      <td>20℃ / 10℃</td>\n",
       "      <td>20</td>\n",
       "      <td>10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>2014/01/20</td>\n",
       "      <td>131560.000000</td>\n",
       "      <td>2014</td>\n",
       "      <td>01</td>\n",
       "      <td>20</td>\n",
       "      <td>20℃ / 9℃</td>\n",
       "      <td>20</td>\n",
       "      <td>9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>2014/01/21</td>\n",
       "      <td>131031.000000</td>\n",
       "      <td>2014</td>\n",
       "      <td>01</td>\n",
       "      <td>21</td>\n",
       "      <td>19℃ / 8℃</td>\n",
       "      <td>19</td>\n",
       "      <td>8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>2014/01/22</td>\n",
       "      <td>124284.000000</td>\n",
       "      <td>2014</td>\n",
       "      <td>01</td>\n",
       "      <td>22</td>\n",
       "      <td>18℃ / 9℃</td>\n",
       "      <td>18</td>\n",
       "      <td>9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22</th>\n",
       "      <td>2014/01/23</td>\n",
       "      <td>115689.000000</td>\n",
       "      <td>2014</td>\n",
       "      <td>01</td>\n",
       "      <td>23</td>\n",
       "      <td>18℃ / 9℃</td>\n",
       "      <td>18</td>\n",
       "      <td>9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>2014/01/24</td>\n",
       "      <td>103834.000000</td>\n",
       "      <td>2014</td>\n",
       "      <td>01</td>\n",
       "      <td>24</td>\n",
       "      <td>21℃ / 13℃</td>\n",
       "      <td>21</td>\n",
       "      <td>13</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24</th>\n",
       "      <td>2014/01/25</td>\n",
       "      <td>89054.080000</td>\n",
       "      <td>2014</td>\n",
       "      <td>01</td>\n",
       "      <td>25</td>\n",
       "      <td>22℃ / 15℃</td>\n",
       "      <td>22</td>\n",
       "      <td>15</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25</th>\n",
       "      <td>2014/01/26</td>\n",
       "      <td>76452.400000</td>\n",
       "      <td>2014</td>\n",
       "      <td>01</td>\n",
       "      <td>26</td>\n",
       "      <td>25℃ / 15℃</td>\n",
       "      <td>25</td>\n",
       "      <td>15</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26</th>\n",
       "      <td>2014/01/27</td>\n",
       "      <td>67931.356070</td>\n",
       "      <td>2014</td>\n",
       "      <td>01</td>\n",
       "      <td>27</td>\n",
       "      <td>22℃ / 15℃</td>\n",
       "      <td>22</td>\n",
       "      <td>15</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27</th>\n",
       "      <td>2014/01/28</td>\n",
       "      <td>62932.000000</td>\n",
       "      <td>2014</td>\n",
       "      <td>01</td>\n",
       "      <td>28</td>\n",
       "      <td>23℃ / 15℃</td>\n",
       "      <td>23</td>\n",
       "      <td>15</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>28</th>\n",
       "      <td>2014/01/29</td>\n",
       "      <td>54918.400000</td>\n",
       "      <td>2014</td>\n",
       "      <td>01</td>\n",
       "      <td>29</td>\n",
       "      <td>24℃ / 16℃</td>\n",
       "      <td>24</td>\n",
       "      <td>16</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>29</th>\n",
       "      <td>2014/01/30</td>\n",
       "      <td>46260.480000</td>\n",
       "      <td>2014</td>\n",
       "      <td>01</td>\n",
       "      <td>30</td>\n",
       "      <td>26℃ / 16℃</td>\n",
       "      <td>26</td>\n",
       "      <td>16</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1370</th>\n",
       "      <td>2017/10/02</td>\n",
       "      <td>128278.000000</td>\n",
       "      <td>2017</td>\n",
       "      <td>10</td>\n",
       "      <td>02</td>\n",
       "      <td>32℃ / 27℃</td>\n",
       "      <td>32</td>\n",
       "      <td>27</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1371</th>\n",
       "      <td>2017/10/03</td>\n",
       "      <td>134228.000000</td>\n",
       "      <td>2017</td>\n",
       "      <td>10</td>\n",
       "      <td>03</td>\n",
       "      <td>34℃ / 27℃</td>\n",
       "      <td>34</td>\n",
       "      <td>27</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1372</th>\n",
       "      <td>2017/10/04</td>\n",
       "      <td>124562.000000</td>\n",
       "      <td>2017</td>\n",
       "      <td>10</td>\n",
       "      <td>04</td>\n",
       "      <td>31℃ / 25℃</td>\n",
       "      <td>31</td>\n",
       "      <td>25</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1373</th>\n",
       "      <td>2017/10/05</td>\n",
       "      <td>176747.000000</td>\n",
       "      <td>2017</td>\n",
       "      <td>10</td>\n",
       "      <td>05</td>\n",
       "      <td>32℃ / 25℃</td>\n",
       "      <td>32</td>\n",
       "      <td>25</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1374</th>\n",
       "      <td>2017/10/06</td>\n",
       "      <td>222162.000000</td>\n",
       "      <td>2017</td>\n",
       "      <td>10</td>\n",
       "      <td>06</td>\n",
       "      <td>33℃ / 26℃</td>\n",
       "      <td>33</td>\n",
       "      <td>26</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1375</th>\n",
       "      <td>2017/10/07</td>\n",
       "      <td>239224.000000</td>\n",
       "      <td>2017</td>\n",
       "      <td>10</td>\n",
       "      <td>07</td>\n",
       "      <td>33℃ / 26℃</td>\n",
       "      <td>33</td>\n",
       "      <td>26</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1376</th>\n",
       "      <td>2017/10/08</td>\n",
       "      <td>234974.000000</td>\n",
       "      <td>2017</td>\n",
       "      <td>10</td>\n",
       "      <td>08</td>\n",
       "      <td>34℃ / 27℃</td>\n",
       "      <td>34</td>\n",
       "      <td>27</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1377</th>\n",
       "      <td>2017/10/09</td>\n",
       "      <td>258824.000000</td>\n",
       "      <td>2017</td>\n",
       "      <td>10</td>\n",
       "      <td>09</td>\n",
       "      <td>33℃ / 26℃</td>\n",
       "      <td>33</td>\n",
       "      <td>26</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1378</th>\n",
       "      <td>2017/10/10</td>\n",
       "      <td>270325.000000</td>\n",
       "      <td>2017</td>\n",
       "      <td>10</td>\n",
       "      <td>10</td>\n",
       "      <td>33℃ / 26℃</td>\n",
       "      <td>33</td>\n",
       "      <td>26</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1379</th>\n",
       "      <td>2017/10/11</td>\n",
       "      <td>276078.000000</td>\n",
       "      <td>2017</td>\n",
       "      <td>10</td>\n",
       "      <td>11</td>\n",
       "      <td>33℃ / 26℃</td>\n",
       "      <td>33</td>\n",
       "      <td>26</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1380</th>\n",
       "      <td>2017/10/12</td>\n",
       "      <td>269369.000000</td>\n",
       "      <td>2017</td>\n",
       "      <td>10</td>\n",
       "      <td>12</td>\n",
       "      <td>32℃ / 26℃</td>\n",
       "      <td>32</td>\n",
       "      <td>26</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1381</th>\n",
       "      <td>2017/10/13</td>\n",
       "      <td>240332.000000</td>\n",
       "      <td>2017</td>\n",
       "      <td>10</td>\n",
       "      <td>13</td>\n",
       "      <td>30℃ / 22℃</td>\n",
       "      <td>30</td>\n",
       "      <td>22</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1382</th>\n",
       "      <td>2017/10/14</td>\n",
       "      <td>215387.000000</td>\n",
       "      <td>2017</td>\n",
       "      <td>10</td>\n",
       "      <td>14</td>\n",
       "      <td>27℃ / 22℃</td>\n",
       "      <td>27</td>\n",
       "      <td>22</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1383</th>\n",
       "      <td>2017/10/15</td>\n",
       "      <td>172456.000000</td>\n",
       "      <td>2017</td>\n",
       "      <td>10</td>\n",
       "      <td>15</td>\n",
       "      <td>23℃ / 20℃</td>\n",
       "      <td>23</td>\n",
       "      <td>20</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1384</th>\n",
       "      <td>2017/10/16</td>\n",
       "      <td>200448.000000</td>\n",
       "      <td>2017</td>\n",
       "      <td>10</td>\n",
       "      <td>16</td>\n",
       "      <td>24℃ / 20℃</td>\n",
       "      <td>24</td>\n",
       "      <td>20</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1385</th>\n",
       "      <td>2017/10/17</td>\n",
       "      <td>213012.000000</td>\n",
       "      <td>2017</td>\n",
       "      <td>10</td>\n",
       "      <td>17</td>\n",
       "      <td>28℃ / 21℃</td>\n",
       "      <td>28</td>\n",
       "      <td>21</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1386</th>\n",
       "      <td>2017/10/18</td>\n",
       "      <td>218822.000000</td>\n",
       "      <td>2017</td>\n",
       "      <td>10</td>\n",
       "      <td>18</td>\n",
       "      <td>29℃ / 22℃</td>\n",
       "      <td>29</td>\n",
       "      <td>22</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1387</th>\n",
       "      <td>2017/10/19</td>\n",
       "      <td>216934.000000</td>\n",
       "      <td>2017</td>\n",
       "      <td>10</td>\n",
       "      <td>19</td>\n",
       "      <td>28℃ / 22℃</td>\n",
       "      <td>28</td>\n",
       "      <td>22</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1388</th>\n",
       "      <td>2017/10/20</td>\n",
       "      <td>214429.000000</td>\n",
       "      <td>2017</td>\n",
       "      <td>10</td>\n",
       "      <td>20</td>\n",
       "      <td>29℃ / 21℃</td>\n",
       "      <td>29</td>\n",
       "      <td>21</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1389</th>\n",
       "      <td>2017/10/21</td>\n",
       "      <td>204973.000000</td>\n",
       "      <td>2017</td>\n",
       "      <td>10</td>\n",
       "      <td>21</td>\n",
       "      <td>28℃ / 20℃</td>\n",
       "      <td>28</td>\n",
       "      <td>20</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1390</th>\n",
       "      <td>2017/10/22</td>\n",
       "      <td>171328.000000</td>\n",
       "      <td>2017</td>\n",
       "      <td>10</td>\n",
       "      <td>22</td>\n",
       "      <td>26℃ / 17℃</td>\n",
       "      <td>26</td>\n",
       "      <td>17</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1391</th>\n",
       "      <td>2017/10/23</td>\n",
       "      <td>200922.000000</td>\n",
       "      <td>2017</td>\n",
       "      <td>10</td>\n",
       "      <td>23</td>\n",
       "      <td>26℃ / 17℃</td>\n",
       "      <td>26</td>\n",
       "      <td>17</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1392</th>\n",
       "      <td>2017/10/24</td>\n",
       "      <td>212075.000000</td>\n",
       "      <td>2017</td>\n",
       "      <td>10</td>\n",
       "      <td>24</td>\n",
       "      <td>28℃ / 20℃</td>\n",
       "      <td>28</td>\n",
       "      <td>20</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1393</th>\n",
       "      <td>2017/10/25</td>\n",
       "      <td>214232.000000</td>\n",
       "      <td>2017</td>\n",
       "      <td>10</td>\n",
       "      <td>25</td>\n",
       "      <td>28℃ / 20℃</td>\n",
       "      <td>28</td>\n",
       "      <td>20</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1394</th>\n",
       "      <td>2017/10/26</td>\n",
       "      <td>215863.000000</td>\n",
       "      <td>2017</td>\n",
       "      <td>10</td>\n",
       "      <td>26</td>\n",
       "      <td>28℃ / 20℃</td>\n",
       "      <td>28</td>\n",
       "      <td>20</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1395</th>\n",
       "      <td>2017/10/27</td>\n",
       "      <td>215716.000000</td>\n",
       "      <td>2017</td>\n",
       "      <td>10</td>\n",
       "      <td>27</td>\n",
       "      <td>28℃ / 20℃</td>\n",
       "      <td>28</td>\n",
       "      <td>20</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1396</th>\n",
       "      <td>2017/10/28</td>\n",
       "      <td>207028.000000</td>\n",
       "      <td>2017</td>\n",
       "      <td>10</td>\n",
       "      <td>28</td>\n",
       "      <td>29℃ / 19℃</td>\n",
       "      <td>29</td>\n",
       "      <td>19</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1397</th>\n",
       "      <td>2017/10/29</td>\n",
       "      <td>171648.000000</td>\n",
       "      <td>2017</td>\n",
       "      <td>10</td>\n",
       "      <td>29</td>\n",
       "      <td>27℃ / 19℃</td>\n",
       "      <td>27</td>\n",
       "      <td>19</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1398</th>\n",
       "      <td>2017/10/30</td>\n",
       "      <td>197594.000000</td>\n",
       "      <td>2017</td>\n",
       "      <td>10</td>\n",
       "      <td>30</td>\n",
       "      <td>26℃ / 16℃</td>\n",
       "      <td>26</td>\n",
       "      <td>16</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1399</th>\n",
       "      <td>2017/10/31</td>\n",
       "      <td>198831.000000</td>\n",
       "      <td>2017</td>\n",
       "      <td>10</td>\n",
       "      <td>31</td>\n",
       "      <td>26℃ / 16℃</td>\n",
       "      <td>26</td>\n",
       "      <td>16</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>1400 rows × 8 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "            Date  DailyElectricity  year month day    weather  \\\n",
       "0     2014/01/01      92750.080000  2014    01  01  20℃ / 12℃   \n",
       "1     2014/01/02     129481.000000  2014    01  02  22℃ / 14℃   \n",
       "2     2014/01/03     161360.000000  2014    01  03  22℃ / 14℃   \n",
       "3     2014/01/04     148608.000000  2014    01  04  21℃ / 12℃   \n",
       "4     2014/01/05     138985.570786  2014    01  05  20℃ / 13℃   \n",
       "5     2014/01/06     156729.000000  2014    01  06  22℃ / 14℃   \n",
       "6     2014/01/07     165086.000000  2014    01  07  22℃ / 15℃   \n",
       "7     2014/01/08     165642.000000  2014    01  08  20℃ / 11℃   \n",
       "8     2014/01/09     164249.000000  2014    01  09  18℃ / 11℃   \n",
       "9     2014/01/10     160739.000000  2014    01  10  17℃ / 13℃   \n",
       "10    2014/01/11     160739.000000  2014    01  11  20℃ / 13℃   \n",
       "11    2014/01/12     141705.000000  2014    01  12   20℃ / 9℃   \n",
       "12    2014/01/13     151591.000000  2014    01  13   16℃ / 8℃   \n",
       "13    2014/01/14     160998.000000  2014    01  14   16℃ / 7℃   \n",
       "14    2014/01/15     159013.000000  2014    01  15   17℃ / 8℃   \n",
       "15    2014/01/16     156966.000000  2014    01  16  18℃ / 10℃   \n",
       "16    2014/01/17     154241.000000  2014    01  17  20℃ / 10℃   \n",
       "17    2014/01/18     146531.000000  2014    01  18   20℃ / 9℃   \n",
       "18    2014/01/19     129968.000000  2014    01  19  20℃ / 10℃   \n",
       "19    2014/01/20     131560.000000  2014    01  20   20℃ / 9℃   \n",
       "20    2014/01/21     131031.000000  2014    01  21   19℃ / 8℃   \n",
       "21    2014/01/22     124284.000000  2014    01  22   18℃ / 9℃   \n",
       "22    2014/01/23     115689.000000  2014    01  23   18℃ / 9℃   \n",
       "23    2014/01/24     103834.000000  2014    01  24  21℃ / 13℃   \n",
       "24    2014/01/25      89054.080000  2014    01  25  22℃ / 15℃   \n",
       "25    2014/01/26      76452.400000  2014    01  26  25℃ / 15℃   \n",
       "26    2014/01/27      67931.356070  2014    01  27  22℃ / 15℃   \n",
       "27    2014/01/28      62932.000000  2014    01  28  23℃ / 15℃   \n",
       "28    2014/01/29      54918.400000  2014    01  29  24℃ / 16℃   \n",
       "29    2014/01/30      46260.480000  2014    01  30  26℃ / 16℃   \n",
       "...          ...               ...   ...   ...  ..        ...   \n",
       "1370  2017/10/02     128278.000000  2017    10  02  32℃ / 27℃   \n",
       "1371  2017/10/03     134228.000000  2017    10  03  34℃ / 27℃   \n",
       "1372  2017/10/04     124562.000000  2017    10  04  31℃ / 25℃   \n",
       "1373  2017/10/05     176747.000000  2017    10  05  32℃ / 25℃   \n",
       "1374  2017/10/06     222162.000000  2017    10  06  33℃ / 26℃   \n",
       "1375  2017/10/07     239224.000000  2017    10  07  33℃ / 26℃   \n",
       "1376  2017/10/08     234974.000000  2017    10  08  34℃ / 27℃   \n",
       "1377  2017/10/09     258824.000000  2017    10  09  33℃ / 26℃   \n",
       "1378  2017/10/10     270325.000000  2017    10  10  33℃ / 26℃   \n",
       "1379  2017/10/11     276078.000000  2017    10  11  33℃ / 26℃   \n",
       "1380  2017/10/12     269369.000000  2017    10  12  32℃ / 26℃   \n",
       "1381  2017/10/13     240332.000000  2017    10  13  30℃ / 22℃   \n",
       "1382  2017/10/14     215387.000000  2017    10  14  27℃ / 22℃   \n",
       "1383  2017/10/15     172456.000000  2017    10  15  23℃ / 20℃   \n",
       "1384  2017/10/16     200448.000000  2017    10  16  24℃ / 20℃   \n",
       "1385  2017/10/17     213012.000000  2017    10  17  28℃ / 21℃   \n",
       "1386  2017/10/18     218822.000000  2017    10  18  29℃ / 22℃   \n",
       "1387  2017/10/19     216934.000000  2017    10  19  28℃ / 22℃   \n",
       "1388  2017/10/20     214429.000000  2017    10  20  29℃ / 21℃   \n",
       "1389  2017/10/21     204973.000000  2017    10  21  28℃ / 20℃   \n",
       "1390  2017/10/22     171328.000000  2017    10  22  26℃ / 17℃   \n",
       "1391  2017/10/23     200922.000000  2017    10  23  26℃ / 17℃   \n",
       "1392  2017/10/24     212075.000000  2017    10  24  28℃ / 20℃   \n",
       "1393  2017/10/25     214232.000000  2017    10  25  28℃ / 20℃   \n",
       "1394  2017/10/26     215863.000000  2017    10  26  28℃ / 20℃   \n",
       "1395  2017/10/27     215716.000000  2017    10  27  28℃ / 20℃   \n",
       "1396  2017/10/28     207028.000000  2017    10  28  29℃ / 19℃   \n",
       "1397  2017/10/29     171648.000000  2017    10  29  27℃ / 19℃   \n",
       "1398  2017/10/30     197594.000000  2017    10  30  26℃ / 16℃   \n",
       "1399  2017/10/31     198831.000000  2017    10  31  26℃ / 16℃   \n",
       "\n",
       "     Maximum temperature Lowest temperature  \n",
       "0                     20                 12  \n",
       "1                     22                 14  \n",
       "2                     22                 14  \n",
       "3                     21                 12  \n",
       "4                     20                 13  \n",
       "5                     22                 14  \n",
       "6                     22                 15  \n",
       "7                     20                 11  \n",
       "8                     18                 11  \n",
       "9                     17                 13  \n",
       "10                    20                 13  \n",
       "11                    20                  9  \n",
       "12                    16                  8  \n",
       "13                    16                  7  \n",
       "14                    17                  8  \n",
       "15                    18                 10  \n",
       "16                    20                 10  \n",
       "17                    20                  9  \n",
       "18                    20                 10  \n",
       "19                    20                  9  \n",
       "20                    19                  8  \n",
       "21                    18                  9  \n",
       "22                    18                  9  \n",
       "23                    21                 13  \n",
       "24                    22                 15  \n",
       "25                    25                 15  \n",
       "26                    22                 15  \n",
       "27                    23                 15  \n",
       "28                    24                 16  \n",
       "29                    26                 16  \n",
       "...                  ...                ...  \n",
       "1370                  32                 27  \n",
       "1371                  34                 27  \n",
       "1372                  31                 25  \n",
       "1373                  32                 25  \n",
       "1374                  33                 26  \n",
       "1375                  33                 26  \n",
       "1376                  34                 27  \n",
       "1377                  33                 26  \n",
       "1378                  33                 26  \n",
       "1379                  33                 26  \n",
       "1380                  32                 26  \n",
       "1381                  30                 22  \n",
       "1382                  27                 22  \n",
       "1383                  23                 20  \n",
       "1384                  24                 20  \n",
       "1385                  28                 21  \n",
       "1386                  29                 22  \n",
       "1387                  28                 22  \n",
       "1388                  29                 21  \n",
       "1389                  28                 20  \n",
       "1390                  26                 17  \n",
       "1391                  26                 17  \n",
       "1392                  28                 20  \n",
       "1393                  28                 20  \n",
       "1394                  28                 20  \n",
       "1395                  28                 20  \n",
       "1396                  29                 19  \n",
       "1397                  27                 19  \n",
       "1398                  26                 16  \n",
       "1399                  26                 16  \n",
       "\n",
       "[1400 rows x 8 columns]"
      ]
     },
     "execution_count": 27,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data_csv"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {},
   "outputs": [],
   "source": [
    "X_GPR = data_csv[['year','month','day','Maximum temperature','Lowest temperature']].values\n",
    "Y_GPR = data_csv[['DailyElectricity']].values"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "metadata": {},
   "outputs": [],
   "source": [
    "# x_train_gpr,x_test_gpr,y_train_gpr,y_test_gpr = train_test_split(X_GPR,Y_GPR,test_size=0.3,random_state=0)\n",
    "x_train_gpr = X_GPR[:1369]\n",
    "y_train_gpr = Y_GPR[:1369]\n",
    "x_test_gpr = X_GPR[1369:]\n",
    "y_test_gpr = Y_GPR[1369:]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {},
   "outputs": [],
   "source": [
    "from sklearn.gaussian_process import GaussianProcessRegressor  \n",
    "from sklearn.gaussian_process.kernels import RBF, ConstantKernel as C# REF就是高斯核函数  "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 47,
   "metadata": {},
   "outputs": [],
   "source": [
    "#核函数\n",
    "kernel = C(0.1, (0.001,0.1))*RBF(0.5,(1e-4,1000))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 48,
   "metadata": {},
   "outputs": [],
   "source": [
    "#创建高斯过程回归,并训练\n",
    "# alpha就是添加到协方差矩阵对角线上的值，n_restarts_optimizer规定了优化过程的次数\n",
    "reg = GaussianProcessRegressor(kernel=kernel,n_restarts_optimizer=10,alpha=0.1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 49,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "GaussianProcessRegressor(alpha=0.1, copy_X_train=True,\n",
       "             kernel=0.316**2 * RBF(length_scale=0.5),\n",
       "             n_restarts_optimizer=10, normalize_y=False,\n",
       "             optimizer='fmin_l_bfgs_b', random_state=None)"
      ]
     },
     "execution_count": 49,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "reg.fit(x_train_gpr,y_train_gpr)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "metadata": {},
   "outputs": [],
   "source": [
    "result_gpr = reg.predict(x_test_gpr)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 50,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.16670391864222822"
      ]
     },
     "execution_count": 50,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "reg.score(x_test_gpr,y_test_gpr)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 193,
   "metadata": {},
   "outputs": [],
   "source": [
    "from mpl_toolkits.mplot3d import Axes3D#实现数据可视化3D  "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 51,
   "metadata": {},
   "outputs": [],
   "source": [
    "from sklearn import preprocessing"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 52,
   "metadata": {},
   "outputs": [],
   "source": [
    "X_GPR_n = data_csv[['year','month','day','Maximum temperature','Lowest temperature']].values\n",
    "Y_GPR_n = data_csv[['DailyElectricity']].values"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 53,
   "metadata": {},
   "outputs": [],
   "source": [
    "x_train_gpr_n = X_GPR_n[:1369]\n",
    "y_train_gpr_n = Y_GPR_n[:1369]\n",
    "x_test_gpr_n = X_GPR_n[1369:]\n",
    "y_test_gpr_n = Y_GPR_n[1369:]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 54,
   "metadata": {},
   "outputs": [],
   "source": [
    "scaler=preprocessing.StandardScaler()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 55,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Anaconda3\\lib\\site-packages\\sklearn\\utils\\validation.py:475: DataConversionWarning: Data with input dtype object was converted to float64 by StandardScaler.\n",
      "  warnings.warn(msg, DataConversionWarning)\n"
     ]
    }
   ],
   "source": [
    "x_train_gpr_n_scaled = scaler.fit_transform(x_train_gpr_n)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 56,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[-5.58053725e-14 -7.78534773e-17  1.29755795e-17  4.15218545e-17\n",
      "  1.03804636e-17]\n",
      "[1. 1. 1. 1. 1.]\n"
     ]
    }
   ],
   "source": [
    "print(x_train_gpr_n_scaled.mean(axis=0))\n",
    "print(x_train_gpr_n_scaled.std(axis=0))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 57,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Anaconda3\\lib\\site-packages\\sklearn\\utils\\validation.py:475: DataConversionWarning: Data with input dtype object was converted to float64 by StandardScaler.\n",
      "  warnings.warn(msg, DataConversionWarning)\n"
     ]
    }
   ],
   "source": [
    "x_test_gpr_n_scaled = scaler.transform(x_test_gpr_n)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 58,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[1.47835573 1.12837176 0.03155553 0.38522452 0.28486979]\n",
      "[4.44089210e-16 2.22044605e-16 1.01681106e+00 4.92025061e-01\n",
      " 5.94324574e-01]\n"
     ]
    }
   ],
   "source": [
    "print(x_test_gpr_n_scaled.mean(axis=0))\n",
    "print(x_test_gpr_n_scaled.std(axis=0))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 59,
   "metadata": {},
   "outputs": [],
   "source": [
    "from sklearn.gaussian_process import GaussianProcessRegressor  \n",
    "from sklearn.gaussian_process.kernels import RBF, ConstantKernel as C# REF就是高斯核函数  "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 72,
   "metadata": {},
   "outputs": [],
   "source": [
    "#核函数\n",
    "kernel = C(0.01, (0.001,0.1))*RBF(0.5,(1e-4,10))\n",
    "# kernel = RBF(1.0,(1e-4,10))\n",
    "#创建高斯过程回归,并训练\n",
    "# alpha就是添加到协方差矩阵对角线上的值，n_restarts_optimizer规定了优化过程的次数\n",
    "reg = GaussianProcessRegressor(kernel=kernel,n_restarts_optimizer=10,alpha=0.1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 73,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "GaussianProcessRegressor(alpha=0.1, copy_X_train=True,\n",
       "             kernel=0.1**2 * RBF(length_scale=0.5),\n",
       "             n_restarts_optimizer=10, normalize_y=False,\n",
       "             optimizer='fmin_l_bfgs_b', random_state=None)"
      ]
     },
     "execution_count": 73,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "reg.fit(x_train_gpr_n_scaled,y_train_gpr_n)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 253,
   "metadata": {},
   "outputs": [],
   "source": [
    "result_gpr = reg.predict(x_test_gpr_n_scaled)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 75,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.07158780091941086"
      ]
     },
     "execution_count": 75,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "reg.score(x_test_gpr_n_scaled,y_test_gpr_n)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 67,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Anaconda3\\lib\\site-packages\\ipykernel_launcher.py:2: DataConversionWarning: A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples,), for example using ravel().\n",
      "  \n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "RandomForestRegressor(bootstrap=True, criterion='mse', max_depth=None,\n",
       "           max_features=0.6, max_leaf_nodes=None,\n",
       "           min_impurity_decrease=0.0, min_impurity_split=None,\n",
       "           min_samples_leaf=1, min_samples_split=2,\n",
       "           min_weight_fraction_leaf=0.0, n_estimators=100, n_jobs=1,\n",
       "           oob_score=False, random_state=None, verbose=0, warm_start=False)"
      ]
     },
     "execution_count": 67,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "clf_rf = RandomForestRegressor(n_estimators=100,max_features=.6)\n",
    "clf_rf.fit(x_train_gpr_n_scaled,y_train_gpr_n)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 68,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([ 92750.08, 129481.  , 161360.  , ..., 281262.  , 270311.  ,\n",
       "       236674.  ])"
      ]
     },
     "execution_count": 68,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "y_train_gpr_n.ravel()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 69,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "-0.4370027408599726"
      ]
     },
     "execution_count": 69,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "clf_rf.score(x_test_gpr_n_scaled,y_test_gpr_n)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 70,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Anaconda3\\lib\\site-packages\\sklearn\\model_selection\\_validation.py:458: DataConversionWarning: A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples,), for example using ravel().\n",
      "  estimator.fit(X_train, y_train, **fit_params)\n",
      "C:\\Anaconda3\\lib\\site-packages\\sklearn\\model_selection\\_validation.py:458: DataConversionWarning: A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples,), for example using ravel().\n",
      "  estimator.fit(X_train, y_train, **fit_params)\n",
      "C:\\Anaconda3\\lib\\site-packages\\sklearn\\model_selection\\_validation.py:458: DataConversionWarning: A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples,), for example using ravel().\n",
      "  estimator.fit(X_train, y_train, **fit_params)\n",
      "C:\\Anaconda3\\lib\\site-packages\\sklearn\\model_selection\\_validation.py:458: DataConversionWarning: A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples,), for example using ravel().\n",
      "  estimator.fit(X_train, y_train, **fit_params)\n",
      "C:\\Anaconda3\\lib\\site-packages\\sklearn\\model_selection\\_validation.py:458: DataConversionWarning: A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples,), for example using ravel().\n",
      "  estimator.fit(X_train, y_train, **fit_params)\n",
      "C:\\Anaconda3\\lib\\site-packages\\sklearn\\model_selection\\_validation.py:458: DataConversionWarning: A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples,), for example using ravel().\n",
      "  estimator.fit(X_train, y_train, **fit_params)\n",
      "C:\\Anaconda3\\lib\\site-packages\\sklearn\\model_selection\\_validation.py:458: DataConversionWarning: A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples,), for example using ravel().\n",
      "  estimator.fit(X_train, y_train, **fit_params)\n",
      "C:\\Anaconda3\\lib\\site-packages\\sklearn\\model_selection\\_validation.py:458: DataConversionWarning: A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples,), for example using ravel().\n",
      "  estimator.fit(X_train, y_train, **fit_params)\n",
      "C:\\Anaconda3\\lib\\site-packages\\sklearn\\model_selection\\_validation.py:458: DataConversionWarning: A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples,), for example using ravel().\n",
      "  estimator.fit(X_train, y_train, **fit_params)\n",
      "C:\\Anaconda3\\lib\\site-packages\\sklearn\\model_selection\\_validation.py:458: DataConversionWarning: A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples,), for example using ravel().\n",
      "  estimator.fit(X_train, y_train, **fit_params)\n",
      "C:\\Anaconda3\\lib\\site-packages\\sklearn\\model_selection\\_validation.py:458: DataConversionWarning: A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples,), for example using ravel().\n",
      "  estimator.fit(X_train, y_train, **fit_params)\n",
      "C:\\Anaconda3\\lib\\site-packages\\sklearn\\model_selection\\_validation.py:458: DataConversionWarning: A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples,), for example using ravel().\n",
      "  estimator.fit(X_train, y_train, **fit_params)\n",
      "C:\\Anaconda3\\lib\\site-packages\\sklearn\\model_selection\\_validation.py:458: DataConversionWarning: A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples,), for example using ravel().\n",
      "  estimator.fit(X_train, y_train, **fit_params)\n",
      "C:\\Anaconda3\\lib\\site-packages\\sklearn\\model_selection\\_validation.py:458: DataConversionWarning: A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples,), for example using ravel().\n",
      "  estimator.fit(X_train, y_train, **fit_params)\n",
      "C:\\Anaconda3\\lib\\site-packages\\sklearn\\model_selection\\_validation.py:458: DataConversionWarning: A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples,), for example using ravel().\n",
      "  estimator.fit(X_train, y_train, **fit_params)\n",
      "C:\\Anaconda3\\lib\\site-packages\\sklearn\\model_selection\\_validation.py:458: DataConversionWarning: A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples,), for example using ravel().\n",
      "  estimator.fit(X_train, y_train, **fit_params)\n",
      "C:\\Anaconda3\\lib\\site-packages\\sklearn\\model_selection\\_validation.py:458: DataConversionWarning: A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples,), for example using ravel().\n",
      "  estimator.fit(X_train, y_train, **fit_params)\n",
      "C:\\Anaconda3\\lib\\site-packages\\sklearn\\model_selection\\_validation.py:458: DataConversionWarning: A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples,), for example using ravel().\n",
      "  estimator.fit(X_train, y_train, **fit_params)\n",
      "C:\\Anaconda3\\lib\\site-packages\\sklearn\\model_selection\\_validation.py:458: DataConversionWarning: A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples,), for example using ravel().\n",
      "  estimator.fit(X_train, y_train, **fit_params)\n",
      "C:\\Anaconda3\\lib\\site-packages\\sklearn\\model_selection\\_validation.py:458: DataConversionWarning: A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples,), for example using ravel().\n",
      "  estimator.fit(X_train, y_train, **fit_params)\n",
      "C:\\Anaconda3\\lib\\site-packages\\sklearn\\model_selection\\_validation.py:458: DataConversionWarning: A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples,), for example using ravel().\n",
      "  estimator.fit(X_train, y_train, **fit_params)\n",
      "C:\\Anaconda3\\lib\\site-packages\\sklearn\\model_selection\\_validation.py:458: DataConversionWarning: A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples,), for example using ravel().\n",
      "  estimator.fit(X_train, y_train, **fit_params)\n",
      "C:\\Anaconda3\\lib\\site-packages\\sklearn\\model_selection\\_validation.py:458: DataConversionWarning: A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples,), for example using ravel().\n",
      "  estimator.fit(X_train, y_train, **fit_params)\n",
      "C:\\Anaconda3\\lib\\site-packages\\sklearn\\model_selection\\_validation.py:458: DataConversionWarning: A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples,), for example using ravel().\n",
      "  estimator.fit(X_train, y_train, **fit_params)\n",
      "C:\\Anaconda3\\lib\\site-packages\\sklearn\\model_selection\\_validation.py:458: DataConversionWarning: A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples,), for example using ravel().\n",
      "  estimator.fit(X_train, y_train, **fit_params)\n",
      "C:\\Anaconda3\\lib\\site-packages\\sklearn\\model_selection\\_validation.py:458: DataConversionWarning: A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples,), for example using ravel().\n",
      "  estimator.fit(X_train, y_train, **fit_params)\n",
      "C:\\Anaconda3\\lib\\site-packages\\sklearn\\model_selection\\_validation.py:458: DataConversionWarning: A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples,), for example using ravel().\n",
      "  estimator.fit(X_train, y_train, **fit_params)\n",
      "C:\\Anaconda3\\lib\\site-packages\\sklearn\\model_selection\\_validation.py:458: DataConversionWarning: A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples,), for example using ravel().\n",
      "  estimator.fit(X_train, y_train, **fit_params)\n",
      "C:\\Anaconda3\\lib\\site-packages\\sklearn\\model_selection\\_validation.py:458: DataConversionWarning: A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples,), for example using ravel().\n",
      "  estimator.fit(X_train, y_train, **fit_params)\n",
      "C:\\Anaconda3\\lib\\site-packages\\sklearn\\model_selection\\_validation.py:458: DataConversionWarning: A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples,), for example using ravel().\n",
      "  estimator.fit(X_train, y_train, **fit_params)\n"
     ]
    }
   ],
   "source": [
    "from sklearn.ensemble import RandomForestRegressor\n",
    "max_features = [.1,.6,.7,.8,.9,1]\n",
    "test_loss = []\n",
    "test_accuarcy = []\n",
    "for max_feat in max_features:\n",
    "    clf = RandomForestRegressor(n_estimators=100,max_features=max_feat)\n",
    "    loss = -cross_val_score(clf,x_train_gpr_n_scaled,y_train_gpr_n,cv=5,scoring='neg_mean_squared_error')#loss 损失函数\n",
    "    test_loss.append(loss.mean())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 83,
   "metadata": {},
   "outputs": [],
   "source": [
    "# plt.subplot(1,2,1)\n",
    "# plt.plot(max_features,test_loss)\n",
    "# plt.title(\"RF\")"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
